package com.acme.meihuayishu;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.acme.meihuayishu.NumDivine.OnClickbtDetailListener;
import com.acme.meihuayishu.tools.Divine;

public class ShiChenDivine extends Activity {

	private TextView tvResult=null;
	private Button btDetail=null;
	private int[] resultNum=null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.shichendivine);
	    tvResult=(TextView)findViewById(R.id.tvShiChen);
	    Divine divine=new Divine();
	    resultNum=divine.getResultByDate();
		tvResult.setText(divine.getResult(resultNum[0],resultNum[1],resultNum[2]));
		tvResult.setTextSize(30);
		btDetail=(Button)findViewById(R.id.btDetail);
	    btDetail.setOnClickListener(new OnClickbtDetailListener());
	    btDetail.setVisibility(View.VISIBLE);
	}
	
	class OnClickbtDetailListener implements OnClickListener
	{

		@Override
		public void onClick(View v) {
			Intent intent=new Intent();
			intent.putExtra("shangNum", resultNum[0]);
			intent.putExtra("xiaNum", resultNum[1]);
			intent.putExtra("bianNum", resultNum[2]);
			intent.setClass(ShiChenDivine.this, DivineDetail.class);
			ShiChenDivine.this.startActivity(intent);
		}
	}
}
